<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateGoodsAttributesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods_attributes', function (Blueprint $table) {
            $table->id();
            $table->integer('gid')->default(0)->comment('商品ID');
            $table->integer('pid')->default(0)->comment('父级ID');
            $table->string('name', 32)->default('')->comment('名称');
            $table->timestamps();
            $table->index('pid');
        });
        DB::statement("ALTER TABLE `goods_attributes` comment '商品属性表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods_attributes');
    }
}
